
<template>
    <div>
        <Row class="expand-row">
            <table class="expand-row">
                <thead class="thead_box">
                        <th class="first_th">批次</th>
                        <th class="second_th">活动开始时间</th>
                        <th class="third_th">短信发送人数</th>
                        <th class="four_th">短信状态</th>
                        <th class="fif_th">微信发送人数</th>
                        <th class="six_th">微信状态</th>
                        <th class="seven_th">权益发送人数</th>
                        <th class="eight_th">权益状态</th>
                        <th class="nine_th">操作</th>
                </thead>
                <tbody  v-for="(item,index) in row.campaignInsts" :key="index" class="tbody_box">
                    <tr class="tbody_title">
                        <td class="first_tbody">{{item.id}}</td>
                        <td class="second_tbody">{{item.run_start_time}}</td>
                        <td class="third_tbody">{{item.total_sms_count}}</td>
                        <td class="four_tbody" v-if="item.smsSendStatus==0">发送失败</td>
                        <td class="fif_tbody" v-else-if="item.smsSendStatus==1">发送完成</td>
                        <td class="six_tbody" v-else-if="item.smsSendStatus==2">发送中</td>
                        <td class="seven_tbody" v-else-if="item.smsSendStatus==9">待执行</td>
                        <td class="seven_tbody" v-else-if="item.smsSendStatus==3">待发送</td>
                        <td class="seven_tbody" v-else-if="item.smsSendStatus=='-'">-</td>
                        <td class="_tbody">{{item.total_wx_count}}</td>
                        <td class="_tbody" v-if="item.wxSendStatus==0">发送失败</td>
                        <td class="_tbody" v-else-if="item.wxSendStatus==1">发送完成</td>
                        <td class="_tbody" v-else-if="item.wxSendStatus==2">发送中</td>
                        <td class="_tbody" v-else-if="item.wxSendStatus==9">待执行</td>
                        <td class="_tbody" v-else-if="item.wxSendStatus==3">待发送</td>
                        <td class="_tbody" v-else-if="item.wxSendStatus=='-'">-</td>
                        <td class="_tbody">{{item.total_coupon_count}}</td>
                        <td class="_tbody" v-if="item.couponSendStatus==0">发送失败</td>
                        <td class="_tbody" v-else-if="item.couponSendStatus==1">发送完成</td>
                        <td class="_tbody" v-else-if="item.couponSendStatus==2">发送中</td>
                        <td class="_tbody" v-else-if="item.couponSendStatus==9">待执行</td>
                        <td class="_tbody" v-else-if="item.couponSendStatus==3">待发送</td>
                        <td class="_tbody" v-else-if="item.couponSendStatus=='-'">-</td>
                        <td class="_tbody" v-if="item.run_status==0">
                            <Button type="primary" @click="runAgain(row.id,item.id)">立即重试</Button>
                        </td>
                        <td class="_tbody" v-if="item.run_status!=0">
                          -
                        </td>
                    </tr>
                </tbody>
            </table>
        </Row>
    </div>
</template>
<script>
  import { fetchMarketingRunAgain } from '@/api/marketing'
    export default {
        props: {
            row: Object
        },
      methods: {
          runAgain(campaignId,campaignInstId){
            var reqParams = {
              campaignId:campaignId,
              campaignInstId:campaignInstId
            }
            fetchMarketingRunAgain(reqParams).then(res => {
                this.TableLoading = false;
                if (res.data.code == 200) {
                  this.$Message.info("该活动批次即将重试");
                } else {
                  this.$Message.error(res.data.msg);
                }
              }
            );
          }
        }
    };
</script>
<style lang="scss" scoped>
    .expand-row{
        width: 75vw;
        border: 1px solid #e8edf1;
        .thead_box{
            th{
                text-align: center;
            }
        }
        .tbody_box{
            .tbody_title{
               td{
                   width: 13%;
                   text-align: center;
               }
            }
        }
    }
</style>
